package backend.web1.endpoint;

import backend.dto.request.CreateBookRequest;
import backend.dto.response.CreateBookResponse;
import backend.dto.response.DescribeBookByIdResponse;
import base.ApiResponse;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import static base.StandardKt.ok;

/** 1 遵守Http标准动词的规范 </br> 2 将request和response建立独立的bean 3 request的对象的参数校验放在Jsr中 4 */
@RestController
@RequestMapping(value = "/book")
public class BookEndpoint {

  // /store/book/buy
  @GetMapping("/{id}")
  ApiResponse<DescribeBookByIdResponse> describeById(@PathVariable String id) {
    return ok();
  }

  @PostMapping("")
  ApiResponse<CreateBookResponse> create(@RequestBody CreateBookRequest request) {
    return ok();
  }

  @PutMapping("/{id}")
  ApiResponse<Object> modify(@PathVariable String id) {
    return ok();
  }

  @DeleteMapping("/{id}")
  ApiResponse<Object> delete(@PathVariable String id) {
    return ok();
  }
}
